import type { MainResponseType } from '@/common/model/response';
import request from '@/utils/axios';

const URL = {
  preRecharge: 'user/preRecharge', //预充值
  transfer: 'user/transfer', //转账
  recharge: 'user/recharge', //充值回调
  withdrawal: 'user/withdrawal', //提现
  exchange: 'swap/exchange', //兑换
};

export function preRecharge(data: {
  APITOKEN: string;
  amount: string;
  currency: string;
}) {
  return request.post<
    any,
    MainResponseType<{
      order_sn: number;
      currency: string;
      amount: string;
      amount_usd: string;
      to_addr: string;
    }>
  >(URL.preRecharge, data);
}
export function transfer(data: {
  APITOKEN: string;
  amount: string;
  currency: string;
  address: string;
  password: string;
  google_code: string;
}) {
  return request.post<any, MainResponseType<string>>(URL.transfer, data);
}
export function recharge(data: { order_sn: string; hash: string }) {
  return request.post<any, MainResponseType<string>>(URL.recharge, data);
}
export function withdrawal(data: {
  APITOKEN: string;
  amount: string;
  currency: string;
  password: string;
  google_code: string;
}) {
  return request.post<any, MainResponseType<string>>(URL.withdrawal, data);
}
export function exchange(data: {
  APITOKEN: string;
  amount: string;
  currency_from: string;
  currency_to: string;
  password: string;
}) {
  return request.post<any, MainResponseType<string>>(URL.exchange, data);
}
